home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Core / PstObj.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  6.5 KB  |  223 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        PstObj.cpp
  3.  
  4.     Contains:    Implementation of ODPersistentObject.
  5.  
  6.     Owned by:    Vincent Lo, Tantek Çelik
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <19>     10/8/95    TJ        Fixes Recomended by Refball
  13.         <18>      8/3/95    RR        #1257260: Collapse B classes. Remove
  14.                                     somInit methods. Don't call IsInitialized
  15.                                     or SubclassResponsibility
  16.         <17>     4/16/95    VL        1230084: Moved so-called standard
  17.                                     properties to POUtils.
  18.         <16>     4/14/95    TÇ        #1235279 BB: InfoUtil & StdTypIO functions
  19.                                     should take Environment* and SU* when
  20.                                     possible
  21.         <15>      4/7/95    EL        Use ODGetTime_TProp/ODSetTime_TProp for
  22.                                     document exchange.
  23.         <14>     2/28/95    VL        1194656: Check for existence before adding
  24.                                     property or value.
  25.         <13>      2/7/95    CC        1190870: CloneInto() also copies creation
  26.                                     date property.
  27.         <12>     1/26/95    eeh        1214080: OpenDoc really uses kODMacIText,
  28.                                     not kODIntlText.
  29.         <11>     1/19/95    VL        1190305: Make sure that all standard
  30.                                     properties are present.
  31.         <10>    12/20/94    VL        1195012: Make Storage calls be
  32.                                     marshallable.
  33.          <9>     9/26/94    JBS        #1188981 - support nonpersistent frames
  34.          <8>      9/9/94    CG        #1183531: Commented out NULL storage unit
  35.                                     reference warning in destructor.
  36.          <7>     8/31/94    VL        1183174: Changed implementation of
  37.                                     CloneInto to not rely on SU::CloneInto.
  38.          <6>     8/29/94    TÇ        #1183567 StdTypIO routine implementation &
  39.                                     fixup
  40.          <5>     8/26/94    VL        1183174: Added implementation to CloneInto.
  41.          <4>     8/16/94    VL        1143605: Added CloneInto.
  42.          <3>     8/12/94    NP        1180762-commented out calls to GetUserName
  43.                                     (they were unused and the interface has
  44.                                     changed.).
  45.          <2>     7/18/94    TÇ        moved code over for somUninit method
  46.          <1>     6/23/94    CG        first checked in
  47.          <0>     6/22/94    SV        SOMverted
  48.          <6>      5/9/94    MB        #1162181: Changes necessary to install MMM.
  49.          <5>     3/28/94    CG        1153547: Use new method
  50.                                     ODSession::GetUserName to set up user
  51.                                     name in Info dlg.
  52.          <4>     3/18/94    CC        Value type of user property changed from
  53.                                     kXMPAppleTEXT to kODASCIIText (but should
  54.                                     be international text!).  (1151636)
  55.          <3>      3/1/94    JA        Include ODMemory.h.
  56.          <2>     2/28/94    CG        (no bug #) Changed calls to HLock and
  57.                                     HUnlock to XMPLockHandle and
  58.                                     XMPUnlockHandle.
  59.         <13>     1/28/94    CC        Moved release of fSU from ReleaseAll() into
  60.                                     destructor.
  61.         <12>     1/27/94    VL        Added ReleaseAll.
  62.         <11>     1/11/94    TÇ        Init... changes
  63.         <10>    12/15/93    TÇ        InitObject changes
  64.          <9>    12/14/93    EL        Use text instead of Str255.
  65.          <8>    12/14/93    TÇ        more InitPersistentObject changes.
  66.                                     Internalize, Initialize went away.
  67.          <7>    12/13/93    TÇ        InitPersistentObject changes
  68.          <6>    12/11/93    TÇ        fixed modified by user code in
  69.                                     InitializePersistent and Externalize
  70.          <5>     12/8/93    TÇ        added code to update ModUser property
  71.          <4>    11/18/93    TÇ        add functionality to InitializePersistent &
  72.                                     Externalize to do Creation, Mod dates and
  73.                                     ModUser
  74.          <3>      8/9/93    PH        Segments
  75.          <2>     6/28/93    PH        Initialize fID in constructor
  76.          <1>     6/16/93    VL        first checked in
  77.  
  78.     To Do:
  79. */
  80.  
  81. #define ODPersistentObject_Class_Source
  82. #define VARIABLE_MACROS
  83. #include <PstObj.xih>
  84.  
  85. #ifndef SOM_ODStorageUnit_xh
  86. #include <StorageU.xh>
  87. #endif    
  88.  
  89. #ifndef SOM_ODFrame_xh
  90. #include <Frame.xh>
  91. #endif    
  92.  
  93. #ifndef SOM_Module_OpenDoc_StdProps_defined
  94. #include <StdProps.xh>
  95. #endif    
  96.  
  97. #ifndef SOM_Module_OpenDoc_StdTypes_defined
  98. #include <StdTypes.xh>
  99. #endif    
  100.  
  101. #ifndef _EXCEPT_
  102. #include <Except.h>
  103. #endif    
  104.  
  105. #ifndef SOM_Module_OpenDoc_Errors_defined
  106. #include <ErrorDef.xh>
  107. #endif    
  108.  
  109. #ifndef _STDTYPIO_
  110. #include <StdTypIO.h>
  111. #endif
  112.  
  113. #ifndef SOM_ODSession_xh
  114. #include <ODSessn.xh>
  115. #endif
  116.  
  117. #ifndef _ODUTILS_
  118. #include <ODUtils.h>
  119. #endif
  120.  
  121. #ifndef _STORUTIL_
  122. #include <StorUtil.h>
  123. #endif
  124.  
  125. #ifndef _ODMEMORY_
  126. #include <ODMemory.h>
  127. #endif
  128.  
  129. #ifndef __TIME_H__
  130. #include <Time.h>
  131. #endif
  132.  
  133. #ifndef __TOOLUTILS__
  134. #include <ToolUtils.h>
  135. #endif
  136.  
  137. #ifndef __RESOURCES__
  138. #include <Resources.h>
  139. #endif
  140.  
  141.  
  142. #pragma segment ODPersistentObject
  143.  
  144. SOM_Scope void     SOMLINK ODPersistentObjectInitPersistentObject(ODPersistentObject *somSelf, Environment *ev,
  145.         ODStorageUnit* storageUnit)
  146. {
  147.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  148.     ODPersistentObjectMethodDebug("ODPersistentObject","InitPersistentObject");
  149.  
  150.     /* Moved from somInit. SOM itself sets fields to zero
  151.     _fSU = kODNULL;
  152.     _fID = 0;
  153.     */
  154.     somSelf->InitRefCntObject(ev);
  155.  
  156.     if ( storageUnit != kODNULL )
  157.     {
  158.         _fSU = storageUnit;
  159.         _fID = _fSU->GetID(ev);
  160.     }
  161. }
  162.  
  163. SOM_Scope void     SOMLINK ODPersistentObjectInitPersistentObjectFromStorage(ODPersistentObject *somSelf, Environment *ev,
  164.         ODStorageUnit* storageUnit)
  165. {
  166.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  167.     ODPersistentObjectMethodDebug("ODPersistentObject","InitPersistentObjectFromStorage");
  168.  
  169.     /* Moved from somInit. SOM itself sets fields to zero
  170.     _fSU = kODNULL;
  171.     _fID = 0;
  172.     */
  173.     somSelf->InitRefCntObject(ev);
  174.  
  175.     _fSU = storageUnit;
  176.     _fID = _fSU->GetID(ev);
  177. }
  178.  
  179. SOM_Scope void     SOMLINK ODPersistentObjectReleaseAll(ODPersistentObject *somSelf, Environment *ev)
  180. {
  181.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  182.     ODPersistentObjectMethodDebug("ODPersistentObject","ReleaseAll");
  183. }
  184.  
  185. SOM_Scope void     SOMLINK ODPersistentObjectExternalize(ODPersistentObject *somSelf, Environment *ev)
  186. {
  187.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  188.     ODPersistentObjectMethodDebug("ODPersistentObject","Externalize");
  189. }
  190.  
  191. SOM_Scope ODStorageUnit*  SOMLINK ODPersistentObjectGetStorageUnit(ODPersistentObject *somSelf, Environment *ev)
  192. {
  193.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  194.     ODPersistentObjectMethodDebug("ODPersistentObject","GetStorageUnit");
  195.  
  196.     return _fSU;
  197. }
  198.  
  199.  
  200. SOM_Scope ODID      SOMLINK ODPersistentObjectGetID(ODPersistentObject *somSelf, Environment *ev)
  201. {
  202.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  203.     ODPersistentObjectMethodDebug("ODPersistentObject","GetID");
  204.  
  205.     return _fID;
  206. }
  207.  
  208. SOM_Scope void  SOMLINK ODPersistentObjectCloneInto(ODPersistentObject *somSelf, Environment *ev,
  209.         ODDraftKey key,
  210.         ODStorageUnit* toSU,
  211.         ODFrame* scopeFrame)
  212. {
  213.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  214.     ODPersistentObjectMethodDebug("ODPersistentObject","CloneInto");
  215. }
  216.  
  217. SOM_Scope void  SOMLINK ODPersistentObjectsomUninit(ODPersistentObject *somSelf)
  218. {
  219.     ODPersistentObjectData *somThis = ODPersistentObjectGetData(somSelf);
  220.     ODPersistentObjectMethodDebug("ODPersistentObject","somUninit");
  221.  
  222.     ODSafeReleaseObject(_fSU);
  223. }